{ "cells": [ { "cell_type": "markdown", "id": "a362c96c", "metadata": {}, "source": [ "# Compare interpolation methods" ] }, { "cell_type": "markdown", "id": "80d20575-9c17-4a25-9d58-97e80601eadd", "metadata": {}, "source": [ "In this notebook we do spatial interpolation of CML rainfall data and compare IDW and Kriging, each with different parameters. Before we can do the spatial interpolation we first have to process the example CML data." ] }, { "cell_type": "code", "execution_count": 1, "id": "cbbdcae7-6419-4dec-9de4-5f64f5bcc32e", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/chwala-c/code/pycomlink/pycomlink/io/examples.py:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.\n", " import pkg_resources\n" ] } ], "source": [ "import pycomlink as pycml\n", "import matplotlib.pyplot as plt\n", "import matplotlib as mpl\n", "import numpy as np\n", "import pandas as pd\n", "import xarray as xr" ] }, { "cell_type": "markdown", "id": "04459b9b-6479-4d19-82ae-52212f933bef", "metadata": {}, "source": [ "## Load example CML data" ] }, { "cell_type": "code", "execution_count": 2, "id": "2f7d34b5-2559-499c-9f93-d518bdd62e61", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 254MB\n",
"Dimensions: (channel_id: 2, cml_id: 500, time: 15840)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 127kB 2018-05-10 ... 2018-05-20T2...\n",
" * cml_id (cml_id) <U3 6kB '0' '1' '2' '3' ... '497' '498' '499'\n",
" length (cml_id) float64 4kB ...\n",
" site_a_latitude (cml_id) float64 4kB ...\n",
" site_a_longitude (cml_id) float64 4kB ...\n",
" site_b_latitude (cml_id) float64 4kB ...\n",
" site_b_longitude (cml_id) float64 4kB ...\n",
" * channel_id (channel_id) <U9 72B 'channel_1' 'channel_2'\n",
" frequency (cml_id, channel_id) float64 8kB ...\n",
" polarization (cml_id, channel_id) <U1 4kB ...\n",
"Data variables:\n",
" rsl (channel_id, cml_id, time) float64 127MB ...\n",
" tsl (channel_id, cml_id, time) float64 127MB ...<xarray.Dataset> Size: 2MB\n",
"Dimensions: (cml_id: 500, channel_id: 2, time: 264)\n",
"Coordinates:\n",
" * cml_id (cml_id) <U3 6kB '0' '1' '2' '3' ... '497' '498' '499'\n",
" length (cml_id) float64 4kB 6.179 5.673 7.52 ... 14.57 4.994\n",
" site_a_latitude (cml_id) float64 4kB 58.26 58.09 58.19 ... 57.77 57.07\n",
" site_a_longitude (cml_id) float64 4kB 1.388 1.637 1.359 ... 1.471 2.09\n",
" site_b_latitude (cml_id) float64 4kB 58.25 58.13 58.21 ... 57.83 57.07\n",
" site_b_longitude (cml_id) float64 4kB 1.304 1.59 1.461 ... 1.298 2.023\n",
" * channel_id (channel_id) <U9 72B 'channel_1' 'channel_2'\n",
" frequency (cml_id, channel_id) float64 8kB 2.491e+10 ... 2.598e+10\n",
" polarization (cml_id, channel_id) <U1 4kB 'V' 'V' 'H' ... 'V' 'V' 'V'\n",
" * time (time) datetime64[ns] 2kB 2018-05-10T01:00:00 ... 2018-...\n",
"Data variables:\n",
" R (channel_id, cml_id, time) float64 2MB 0.0 0.0 ... 0.0 0.0